/*
 * Map.cpp
 *
 *  Created on: May 26, 2011
 *      Author: stud
 */

#include "Map.h"
#include <stdio.h>
#include <iostream>

using namespace std;

sWord * Map::getData()
{
	return data;
}

void Map::setData(sWord * newData)
{
	int i=0;
	for(i = 0;i<registers;i++)
	{
		data[i].Word = newData[i].Word;
	}
}

void Map::showData()
{
	int i=0;

	for(i=0;i<registers;i++)
	{
		cout << " " << data[i].Word << " ";
	}
}

Map::Map(int numRegisters)
{
	registers = numRegisters;
	data = (sWord *)malloc(registers * (unsigned) (sizeof(sWord)));
}

void Map::initMap(int mode)
{
	int i = 0;

	for(i=0;i<registers;i++)
	{
		if (mode==0)
			data[i].Word = 0;
		else
			data[i].Word = i;
	}
}

Map::~Map()
{
	free(data);
}
